/* 
 * iqdma.h
 * Created on July 22, 2005; 1:42 PM
 * by VRamadurai
 */
#ifndef _IQDMA_H_
#define _IQDMA_H_

#include <machine/machdefs.h>
#include <os/osapi.h>
#include <machine/mmio.h>

#include "hs_types.h"
#include "HsTypes.h"
#include "icrdefs_3500.h"

#ifdef SAMSUNG_RF

#define  TX_CORE					(2)
#define  TX_PSD_STATUS				(MMIO_SB3500PSDA_STATUS)
#define  TX_PSD						(MMIO_SB3500D2A_A_OFF)
#define	 TX_PSD_EN					(MMIO_SB3500PSDA_EN)

#else

#define  TX_CORE					(3)//(1)
#define  TX_PSD_STATUS				(MMIO_SB3500PSDA_STATUS)
#define  TX_PSD						(MMIO_SB3500D2A_A_OFF)
#define	 TX_PSD_EN					(MMIO_SB3500PSDA_EN)

#endif

#define  RX_CORE					(1)

#define  NSUBFS_RX              	(4) 
#define  SUB_BUF_SIZE_RX        	(11*16*4) //8 22samples, 11 16samples
#define  GLOBAL_BUF_SIZE_RX    		(NSUBFS_RX*SUB_BUF_SIZE_RX)  

#define  NSUBFS_TX              	(2) 
#define  SUB_BUF_SIZE_TX        	(11*16) //8 22samples, 11 16samples
#define  GLOBAL_BUF_SIZE_TX    		(NSUBFS_TX*SUB_BUF_SIZE_TX)  

//add test
#define  TX_RATE		  (20)
#define  TX_LENGTH_BYTES  (128)
#define  TX_ZERO_SIZE	  (GLOBAL_BUF_SIZE_TX)//(11*16*2)
#define  MOD_QPSK         (2)
#define  FRAME_SIZE       ((128 + 16 + 48 + ((TX_LENGTH_BYTES + 4)/MOD_QPSK)*8) * 22)
#define  PSD_CNT          ((FRAME_SIZE + TX_ZERO_SIZE)/SUB_BUF_SIZE_TX)
#define  TX_FRAME_TEST    (30000)
//end add

//#define SCALE_ADC
/*#ifdef SCALE_ADC
#define DAC_MAX         -64 //(1023 << 6)
#define DAC_MIN         0 //(0 << 6)
#define DAC_SILENCE     0
#define DAC_ZERO        0
#else
#define DAC_MAX         (511)
#define DAC_MIN         (-512)
#define DAC_SILENCE     0
#define DAC_ZERO        0
#endif

#ifdef SCALE_ADC
#define IQ_SHIFT        6
#define IQ_BIAS         512
#define IQ_SCALE(x)     (((unsigned short)(x) >> IQ_SHIFT) - IQ_BIAS)
#else
#define IQ_SHIFT        0
#define IQ_BIAS         0
#define IQ_SCALE(x)     (x)
#endif*/

#define DAC_MAX         (16383)//(32767)//(16383)//(8191)//
#define DAC_MIN         (-16384)//(-32768)//(-16384)//(-8192)//
#define DAC_SILENCE     0
#define DAC_ZERO        0
#define IQ_SHIFT        5//4
#define IQ_BIAS         0//(-200)
#define IQ_SCALE(x)     (((unsigned short)(x) >> IQ_SHIFT) - IQ_BIAS)//(x)

#define ENABLE_AD9361 (1)
#define ENABLE_BASEBAND_LOOP (0)
/*Max Size is given to support all data rates */
extern hs_int16_t GPHY_asInputI[GLOBAL_BUF_SIZE_RX];
extern hs_int16_t GPHY_asInputQ[GLOBAL_BUF_SIZE_RX];

extern hs_int16_t DacOutI[GLOBAL_BUF_SIZE_TX+32];   
extern hs_int16_t DacOutQ[GLOBAL_BUF_SIZE_TX+32];


#endif
